package net.zjitc.io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;

/**
 * @Author admin
 * @Date 2019/4/9 16:58
 * 将当前文件example.txt拷贝到D盘的根目录
*/
public class CopyFile {
    public static void main(String[] args) {

        try {
            /*输入流，读取，读取源文件*/
            FileInputStream fis=new FileInputStream("example.txt");
           /*输出流*/
            FileOutputStream fos=new FileOutputStream("D:\\a.txt",true);
            int len= 0;
            while (fis.read()!=-1){
                fos.write(len);
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }
}
